class RecentCounter {
private:
    //vector<int> v;
    queue<int> q;
public:
    RecentCounter() {

    }
    int ping(int t) {
        // v.push_back(t);
        // int judge = t-3000;
        // int size = v.size();
        // int res = 0;
        // for(int i = 0;i < size;++i){
        //     if(v[i] >= judge){
        //         res = size-i;
        //         break;
        //     }
        // }
        // return res;
        q.push(t);
        int judge = t - 3000; //每次请求的最左边界
        while (judge > q.front()) {
            q.pop();
        }
        return q.size();
    }
};